<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>系统消息</title>
    <link rel="shortcut icon" href="../../images/favicon.png"/>
    <link rel="stylesheet" href="../../../vendors/iconfonts/mdi/css/materialdesignicons.min.css"/>
    <link rel="stylesheet" href="../../vendors/css/vendor.bundle.base.css"/>
    <link rel="stylesheet" href="../../css/style.css"/>
    <link rel="shortcut icon" href="../../images/favicon.png"/>
    <script type="text/javascript" src="../../js/Calendar.js"></script>

    <style type="text/css">
        #menu, #ac {
            list-style: none; /* 将默认的列表符号去掉 */
            padding: 0; /* 将默认的内边距去掉 */
            margin: 0; /* 将默认的外边距去掉 */
        }
        #ac li {
            float: left; /* 往左浮动 */
        }
        #anu{
            float: right;
        }
    </style>
</head>

<body>

<div calss="card-head">

    <h6 class="card-title">首页/运营管理/消息管理/系统消息</h6>
    <div class="card">
        <div class="card-body2">
            <div id="menu" style="margin-left:5px;margin-top:20px ">
                <form class="form-inline" id="formSystem" method="post">
                    <input type="hidden" id="currentPageNo" name="currentPageNo" value="1"/>
                    <!--th:action="@{/lhuaw/qryConditionPageAll}"-->
                    <ul id="ac">
                        <li>
                            <p>消息标题：
                                <input type="text" class="form-control mb-2 mr-sm-2" id="messageTitle1" name="messageTitle" th:value="${messageTitle}"
                                       placeholder="  消息标题" style=" width:200px"/>
                            </p>
                        </li>
                        <li>
                            <p>发布人员：
                                <input list="test" type="text" class="form-control" id="publisher1" name="publisher" th:value="${publisher}"
                                       placeholder="  全部" style=" margin-right:20px;"/>
                                <datalist id="test">
                                    <option th:each="SystemMessage:${qrySystemMessageList}"
                                            th:text="${SystemMessage.publisher}"></option>
                                </datalist>
                            </p>
                        </li>
                        <!--<li>-->
                            <!--<p>发布时间：-->
                                <!--&lt;!&ndash;<input name="control_date" type="text" style="text-decoration:none; margin-right:20px;"&ndash;&gt;-->
                                       <!--&lt;!&ndash;class="form-control" id="releaseTime" readonly="readonly" placeholder="  请选择日期"&ndash;&gt;-->
                                       <!--&lt;!&ndash;th:onclick="new Calendar().show(this);"/>&ndash;&gt;-->
                            <!--</p>-->
                        <!--</li>-->
                        <li>
                            <button type="button" id="systemSubmit"
                                    style="width:80px;text-align:center;margin-top:3px;height:40px;color:white;border-radius:5px;background:pink">
                                查询
                            </button>
                        </li>
                    </ul>
                </form>
            </div>
        </div>
    </div>
</div>
<div class="card-body">
    <div id="u17880" class="ax_default _默认样式">
        <div id="u17880_div" class=""></div>
        <div id="u17880_text" class="text ">
            <p style="font-size:18px;"><span
                    style="font-family:'Arial Normal', 'Arial';font-weight:400;font-size:12px;text-decoration:none;"> </span><span
                    style="font-family:'微软雅黑';font-weight:400;font-size:12px;text-decoration:none;">数据列表</span></p>
        </div>
    </div>
    <div id="anu">
        <button id="addDeptBtn" type="button" data-toggle="modal"
                data-target="#myModal">发布消息</button>
        <button  disabled="disabled">显示条数</button>
        <button  disabled="disabled">排序方式</button>
    </div>
    <table class="table table-info">
        <thead>
        <tr>
            <th>
                <input type="checkbox" id="chooseAll" style=" vertical-align: middle; margin-top: -13px;margin-left: 15px;" class="form-check-input"/>
            </th>
            <th>
                编号
            </th>
            <th>
                消息标题
            </th>
            <th>
                发布时间
            </th>
            <th>
                发布人员
            </th>
            <th>
                操作
            </th>
        </tr>
        </thead>
            <tbody>
            <tr th:attr="sId=${SystemMessage.sId}+'_row'" th:each="SystemMessage:${qrySystemMessageList}" class="table-warning">
                <th>
                    <input type="checkbox" style=" vertical-align: middle; margin-top: -5px;margin-left: 15px;" class="form-check-input"/>
                </th>
                <th th:text="${SystemMessage.sId}"></th>
                <th th:text="${SystemMessage.messageTitle}"></th>
                <th th:text="${SystemMessage.releaseTime}"></th>
                <th th:text="${SystemMessage.publisher}"></th>
                <th>
                    <a href="javascript:;" class="seeBtn"  id="seeBtn"  name="seeBtn" data-toggle="modal" data-target="#showSystemInfo" th:attr="sId=${SystemMessage.sId}">查看</a>
                    <a href="javascript:;" class="delSystem" th:onclick="'del(this)'" th:attr="sId=${SystemMessage.sId}">删除</a></th>
            </tr>
            </tbody>
    </table>
    <!--<分页查询>-->
    <div class="page-bar">
        <ul class="page-num-ul clearfix">
            <li>共<span th:text="${page.totalCount }"></span>条记录&nbsp;&nbsp; <span th:text="${page.pageIndex}"></span>/<span th:text="${page.totalPageCount}"></span> 页</li>
            <button th:onclick="'javascript:pageQry(document.forms[0],1)'" th:if="${page.pageIndex gt 1 }">首页</button>
            <button th:onclick="'javascript:pageQry(document.forms[0],'+${page.pageIndex - 1}+')'"  th:if="${page.pageIndex gt 1 }">上一页</button>
            <button th:onclick="'javascript:pageQry(document.forms[0],'+${page.pageIndex + 1}+')'" th:if="${page.pageIndex lt page.totalPageCount}">下一页</button>
            <button th:onclick="'javascript:pageQry(document.forms[0],'+${page.totalPageCount}+')'" th:if="${page.pageIndex lt page.totalPageCount}">最后一页</button>
            &nbsp;&nbsp;
        </ul>
        <span class="page-go-form"><label>跳转至</label>
             <input type="hidden" id="totalPageCount" th:value="${page.totalPageCount}"/>
             <input type="text" name="inputPage" id="inputPage" class="page-key"/>页
             <button type="button" class="page-btn"
                     th:onClick="'jumpPage(document.forms[0],document.getElementById(\''+inputPage+'\').value)'">GO</button>
		</span>
    </div>
    <!--</分页查询>-->
    <!--新增-->
    <!-- 弹出层添加列表 -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" >
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                </div>
                <h4 class="modal-title text-center" id="myModalLabel">发布消息</h4>
                <form class="forms-sample" id="editSystemFrom">
                    <input type="hidden" id="sId" name="sId" value="0"/>
                    <div class="modal-body">
                        <div class="form-group">
                            <label for="messageTitle" class="text-left">消息标题</label>
                            <input type="text" name="messageTitle" class="form-control" id="messageTitle"
                                   placeholder="请输入消息标题"/>
                        </div>
                        <input type="hidden" id="publisher" name="publisher" value="admin"/>
                        <div class="form-group">
                            <label for="messageContents" class="text-left">消息内容</label>
                            <textarea class="form-control" name="messageContents" id="messageContents"
                                      rows="4"></textarea>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" id="editBtn" class="btn btn-primary" data-dismiss="modal">保存
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!-- /弹出层添加列表 -->

    <!--弹出层查看-->
    <div class="modal fade" id="showSystemInfo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title text-center" id="seeSystem">查看消息</h4>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                </div>
                <form class="forms-sample" id="SystemFrom">
                        <input  type="hidden" id="SystemsId" name="sId" />
                        <div class="modal-body">
                        <div class="form-group">
                            <label for="systemTitle" class="text-left"></label>
                            <input type="text" name="rName" class="form-control" id="systemTitle"
                                   disabled="disabled" value="" style="margin-left: 150px;background-color:transparent;border:0;font-size: 20px;font-family:华文彩云"/>
                        </div>
                            <input type="text" name="rName" class="form-control" id="systemreleaseTime"
                                   disabled="disabled" value="" style="margin-left: 110px;margin-top:-40px;background-color:transparent;border:0;font-size: 20px;font-family:华文彩云"/>
                            <div class="form-group">
                                <label for="systemContents" class="text-left"></label>
                                <textarea class="form-control" name="messageContents" id="systemContents"
                                          disabled="disabled" value="" style="background-color:transparent;border:0;font-size: 15px;font-family:华文彩云"></textarea>
                            </div>
                            <div class="team">
                                <input type="text"  disabled="disabled" value="星火贷团队" style="margin-left: 310px;background-color:transparent;border:0;font-size: 15px;font-family:华文彩云"/>
                            </div>
                        </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <!--/弹出层查看-->


    <!--新增-->
    <!--分页代码-->
</div>



<script src="../../vendors/js/vendor.bundle.base.js"></script>
<script src="../../vendors/js/vendor.bundle.addons.js"></script>
<script src="../../js/off-canvas.js"></script>
<script src="../../js/misc.js"></script>
<script src="../../js/dashboard.js"></script>

<script type="text/javascript" src="../../js/jquery-3.2.1.min.js"></script>
<script type="text/javascript">


    // 新增
    $("#editBtn").click(function () {
        var editSystemFrom = $("#editSystemFrom");
        var sId = $("#sId").val();
        $.ajax({
            //发送新增ajax请求
            "url": "/lhuaw/addSystem?systemMessage=" + editSystemFrom.serialize() ,
            "type": "post",
            "data": {
                "sId": sId
            },
            "dataType": "json",
            success: function (data) {
                alert(data.msg);
                // $("#Conframe").load("/lhuaw/qryConditionPageAll?currentPageNo=1");
                window.location.href="/lhuaw/qryConditionPageAll?currentPageNo=1";
            },
            error: function () {
                alert("ajax异常");
            }
        })
    });
    //新增


    //查看
    $(".seeBtn").click(function () {
        var sId= $(this).attr('sId');
        $.ajax({
            "url": "/lhuaw/seeSystem/"+ sId+"",
            "type": "post",
            "data":"",
            "dataType": "json",
            success: function (data) {
                var userFind = data;
                $("#systemTitle").val(userFind.messageTitle);
                $("#systemreleaseTime").val(userFind.releaseTime);
                $("#systemContents").val(userFind.messageContents);
            },
            error: function () {
                alert("ajax异常");
            }
        });
    });
    //查看


    //01.分页查询
    function pageQry(form, pageIndex) {
        $.ajax({
            url:"/lhuaw/qryConditionPageAll?currentPageNo="+pageIndex+"",
            type:"post",
            data:"page=1",
            success:function(){
                // $("#Conframe").load("/lhuaw/qryConditionPageAll?currentPageNo="+pageIndex+"");
                window.location.href="/lhuaw/qryConditionPageAll?currentPageNo="+pageIndex;
            },
            error:function () {
               alert("错误");
            }
        })
    }
    //02.跳转页查询
    function jumpPage(form, jumpPageIndex) {
        //01.数字校验
        var reg = /^[1-9]\d{0,}$/;
        if (!reg.test(parseInt(jumpPageIndex))) {
            alert("请输入合法的数字");
            return;
        }
        //02.范围校验：当前页不能大于总页数
        if (jumpPageIndex > document.getElementById("totalPageCount").value) {
            alert("已经是最后一页!");
            return;
        }
        $.ajax({
            type:"post",
            url:"/lhuaw/qryConditionPageAll?currentPageNo="+jumpPageIndex+"",
            data:"page=1",
            success: function(){
                // $("#Conframe").load("/lhuaw/qryConditionPageAll?currentPageNo="+jumpPageIndex+"");
                window.location.href="/lhuaw/qryConditionPageAll?currentPageNo="+jumpPageIndex;
            },
            error:function () {
                alert("错误");
            }
        })
    }
    //删除
    function del(ele) {
        var $ele =$(ele);
        var sId =$ele.attr('sId');
        $.ajax({
            "url":'/lhuaw/delete/'+sId+"",
            "type":"get",
            "data":"",
            "dataType":"json",
            "success":function(data){
                alert("删除成功>>>");
                if(data.success) {
                    $("#" + sId + "_row").remove();
                    // $("#Conframe").load("/lhuaw/qryConditionPageAll?currentPageNo=1");
                    window.location.href="/lhuaw/qryConditionPageAll?currentPageNo=1";
                }else
                    alert("删除失败>>>>>>>");
            },
            "error":function(e){
                alert("ajax异常");
            }
        });
    }
    //删除

    //条件查询
    $("#systemSubmit").click(function () {
        $.ajax({
            type: "post",
            dataType: "text",
            url: "/lhuaw/qryConditionPageAll?currentPageNo=1",
            data:$("#formSystem").serialize(),
            success: function (data) {
                alert($("#formSystem").serialize());
                // $("#Conframe").load("/lhuaw/qryConditionPageAll?"+$("#formSystem").serialize()+"");
                window.location.href="/lhuaw/qryConditionPageAll?"+$("#formSystem").serialize();
            },
            error: function () {
                alert("错误");
            }
        });
    })

    //条件查询
</script>


</body>
</html>